package com.changpei.core.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changpei.common.result.Result;
import com.changpei.core.pojo.Praise;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *
 * <p>Title : Praise</p>
 * <p>Description : Praise</p>
 * @author weibiao
 */
@FeignClient(name = "core")
@RequestMapping("/praise")
public interface PraiseFeign {

    /**
     *
     * <p>Title : add</p>
     * <p>Description : 新增Praise数据</p>
     * @param praise
     * @return
     */
    @PostMapping(value = "/add")
    Result<Long> add(@RequestBody Praise praise);

    /**
     *
     * <p>Title : delete</p>
     * <p>Description : 根据ID删除Praise数据</p>
     * @param id
     * @return
     */
    @DeleteMapping(value = "/{id}")
    Result<String> delete(@PathVariable Long id);

    /**
     *
     * <p>Title : update</p>
     * <p>Description : 修改Praise数据</p>
     * @param praise
     * @param id
     * @return
     */
    @PutMapping(value = "/{id}")
    Result<String> update(@RequestBody Praise praise, @PathVariable Long id);

    /**
     *
     * <p>Title : findPage</p>
     * <p>Description : Praise分页搜索实现</p>
     * @param pageNum : 当前页
     * @param pageSize : 每页显示多少条
     * @return
     */
    @GetMapping(value = "/search/{pageNum}/{pageSize}")
    Result<Page<Praise>> findPage(@PathVariable int pageNum, @PathVariable int pageSize);

    /**
     *
     * <p>Title : findPage</p>
     * <p>Description : Praise分页条件搜索实现</p>
     * @param praise
     * @param pageNum : 当前页
     * @param pageSize : 每页显示多少条
     * @return
     */
    @PostMapping(value = "/search/{pageNum}/{pageSize}")
    Result<Page<Praise>> findPage(@RequestBody(required = false) Praise praise, @PathVariable int pageNum, @PathVariable int pageSize);

    /**
     *
     * <p>Title : findList</p>
     * <p>Description : 多条件搜索数据</p>
     * @param praise
     * @return
     */
    @PostMapping(value = "/search")
    Result<List<Praise>> findList(@RequestBody(required = false) Praise praise);

    /**
     *
     * <p>Title : findById</p>
     * <p>Description : 根据ID查询Praise数据</p>
     * @param id
     * @return
     */
    @GetMapping(value = "/{id}")
    Result<Praise> findById(@PathVariable Long id);

    /**
     *
     * <p>Title : findOne</p>
     * <p>Description : 多条件搜索Praise数据，结果返回一条</p>
     * @param praise
     * @return
     */
    @PostMapping(value = "/findOne")
    Result<Praise> findOne(@RequestBody(required = false) Praise praise);

    /**
     *
     * <p>Title : findAll</p>
     * <p>Description : 查询Praise全部数据</p>
     * @return
     */
    @GetMapping(value = "/all")
    Result<List<Praise>> findAll();
}